package com.ayf.payment.game.api.mapper;

import com.ayf.payment.game.api.dto.GroupsDTO;
import com.ayf.payment.game.api.dto.criteria.GroupsSelectCriteria;
import com.ayf.payment.game.api.entity.Groups;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface GroupsMapper extends Mapper<Groups> {

    @Select("select g.id as groupsId,  g.group_name as groupName  from g_groups g  where g.merchant_id=#{merchantId} and g.group_status='ENABLE'")
    public List<GroupsDTO> selectByDTO(@Param("merchantId") Integer merchantId);

    @Select("select id, merchant_id as merchantId, group_name as groupName, group_status as groupStatus  from g_groups where merchant_id=#{merchantId} and id=#{groupId}")
    public Groups selectById(@Param("merchantId") Integer merchantId, @Param("groupId") String groupId);

    @Select("select id as groupsId,  group_name as groupName from g_groups where group_status='ENABLE' and " +
            "merchant_id=#{merchantId} and id=#{groupId}")
    public GroupsDTO selectByIdDTO(@Param("merchantId") Integer merchantId, @Param("groupId") String groupId);

    /**
     * 查询出分组信息
     *
     * @param groupsSelectCriteria
     * @return
     */
    List<GroupsDTO> selectGroupInfo(@Param("group") GroupsSelectCriteria groupsSelectCriteria);

    /**
     * 查询出分组信息
     *
     * @param partitionId
     * @return
     */
    GroupsDTO selectGroup(@Param("partitionId") String partitionId);

    List<GroupsDTO> selectList(@Param("group")GroupsDTO groupsDTO);
}